<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/displaytag.tld" prefix="display" %>
<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="java.util.*, com.cs.beneficios.common.util.Atributo"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Buscar Beneficiario</title>
<link href="../../css/jdeveloper.css" rel="stylesheet" media="screen"/>

<script language="javascript">
 function enviar(locacion){
  document.frmbuscar.action=locacion;
  document.frmbuscar.submit();
 }
 
 function activarvalor(locacion1)
  {
    //alert(locacion1);
    document.frmbuscar.action=locacion1;
    document.frmbuscar.submit();
  }
 
 
</script>

</head>
<body>
<script src="<%=request.getContextPath()%>/js/displaytag.js" type="text/javascript"></script>
 <link href="<%= request.getContextPath() + "/css/bloques.css" %>" rel="stylesheet" type="text/css">
<!-- <link href="<%= request.getContextPath() + "/css/table.css" %>" rel="stylesheet" type="text/css">-->
  
  <P></P>
  <form name="frmbuscar" method="get">
  
    <table border="0" width="50" align="center">
      <tr>
          <td align="left" class="titulosenblanco"><STRONG>Beneficio:</STRONG></td>
          <td>
             <logic:iterate id="subpro" name="listatam" type="com.cs.beneficios.business.model.SubProgramaVO">
                <% String codeSubpro = request.getParameter("codigo");
                   if((Object)codeSubpro == null)
                   {
                      codeSubpro = (String)session.getAttribute("codsubpro");
                   }
                
                %>
                <html:select styleClass="form" name="subpro" property="codigo" value="<%=codeSubpro%>">
                <html:options name="subprogramas" labelName="codigo" labelProperty="nombre" property="code" collection="subprogramas" />
               </html:select>
            </logic:iterate>
          </td>
          <td align="center">
               <% String Ruta2 = "'"+request.getContextPath() + "/subprogramas/atributos/ActivationAtri.do'"; %>
                <input type="image" onclick="activarvalor(<%=Ruta2%>)" src="<%= request.getContextPath() + "/images/activar.gif" %>"/>
                <br/>
                <span>Activar Atributo</span>
          </td>  
      </tr>
    </table>
    <DIV align="center">
      
    <logic:present name="msg" scope="request">
          <DIV align="center">
            <%=request.getAttribute("msg")%>
          </DIV>
          <%
            String codeSubprograma = (String)request.getAttribute("codSubprograma");
            String codePrograma = (String)request.getAttribute("codPrograma");
          %>
          <input type="hidden" name="codeSubPrograma" value="<%=codeSubprograma%>" >
          <input type="hidden" name="codePrograma"  value="<%=codePrograma%>">
          <input type="hidden" name="IdUbicacion"  value="BuscarAtributo">
          <DIV align="center">
              <P>
                <input type="button" value="Asignar Sede" language="javascript" onclick="enviar('<%=request.getContextPath() + "/Sedes/BeneficiosSede.do"%>')"/>
              </P>
          </DIV>
    </logic:present>
      
      <P>
        <input type="button" value="Buscar" language="javascript" onclick="enviar('BuscarAtributo.do')"/>
      </P>
    </DIV>
    
    <table  cellspacing="3" cellpadding="2" border="0" width="90%" align="center">
        <tr>
        <td>
          <logic:notPresent name="atrisubprog">
            <DIV align="left">El subprograma no tiene atributos</DIV>
          </logic:notPresent>
        
          <logic:present name="atrisubprog"> 
              <display:table name="sessionScope.atrisubprog" pagesize="20" id="atri" cellpadding="3" cellspacing="1" style="width:100%" class="bordestable">
                  <display:column headerClass="headerTable" title="Orden" class="Numero" sortable="true" >
                      <DIV align="center">
                      <bean:write name="atri" property="orden" /> 
                      </DIV>
                  </display:column>
                  
                  <display:column headerClass="headerTable" title="Nombre Atributo" class="Numero" sortable="true" >
                    <DIV align="center">
                    
                      <bean:write name="atri" property="nombre" /> 
                     
                    </DIV>
                  </display:column>
                  <display:column headerClass="headerTable" title="Tiene lista" class="Numero" sortable="true" >
                    <DIV align="center">
                      <bean:write name="atri" property="valLista" /> 
                    </DIV>
                  </display:column>
                  <display:column headerClass="headerTable" title="Modificar" class="Numero" >
                      <DIV align="center">
                      <html:link paramId="codatributo" paramName="atri" paramProperty="codigo" page="/PropiedadesAtri.do">
                           <img border="0" src="<%=request.getContextPath() + "/images/modificar.gif"%>"/>
                      </html:link>
                      </DIV>
                  </display:column>
                  
                  <display:column headerClass="headerTable" title="Eliminar" class="Numero" >
                      <DIV align="center">
                      <html:link paramId="codatributo" paramName="atri" paramProperty="codigo" page="/EliminarAtri.do">
                          <img border="0" src="<%=request.getContextPath() + "/images/Delete.gif"%>"/>
                      </html:link>
                      </DIV>
                  </display:column>
                  
                  <display:column headerClass="headerTable" title="Mostrar Restriccion" class="Numero" >
                  <DIV align="center">
                  <bean:define id="restriccion" name="atri" property="restriccion"></bean:define>
                  <% if(!restriccion.equals("0")){
                  %>
                   <html:link paramId="codatributo" paramName="atri" paramProperty="codigo" page="/subprogramas/atributos/ModificarRestric.do">
                       <img border="0" src="<%=request.getContextPath() + "/images/ver.gif"%>"/>
                   </html:link>
                  <%}%>
                  </DIV>
                  </display:column>
                  
                  <display:column headerClass="headerTable" title="Crear Restriccion" class="Numero" >
                  <DIV align="center">
                  <bean:define id="restriccion2" name="atri" property="restriccion"></bean:define>
                  <% if(restriccion2.equals("0")){
                  %>
                   <html:link paramId="codatributo" paramName="atri" paramProperty="codigo" page="/subprogramas/atributos/CrearRest.do">
                        <img border="0" src="<%=request.getContextPath() + "/images/nuevo.gif"%>"/>
                   </html:link>
                  <%}%>
                  </DIV>
                  </display:column>
            </display:table>
            
            <P>
              <% String strCodigo = request.getParameter("codigo"); 
              String Ruta = "'"+request.getContextPath() + "/AtributoSubprograma.do'";
              %>
              <DIV align="center">
              <input type="HIDDEN" name="subpro" value="<%=strCodigo%>"/>
              <input type="button" value="Adicionar Atributo" language="javascript" onclick="enviar(<%=Ruta%>)"/>
              </DIV>
            </P>
            
          </logic:present>
          </td>
        </tr>
    </table>
    
    <DIV align="center">
      <input type="HIDDEN" name="accion" value="1"/>
      <input type="hidden" name="mostrarregresar" value="2"> 
     
    </DIV>
    
</form>

</body>
</html>
